<template>
  <div class="list">
    <div class="main">
      <div class="left">
        <div class="left-list" v-for="d in list" :key="d.id">
          {{d.name}}
        </div>
      </div>
      <div class="right">
        <div class="right-list" v-for="d in list" :key="d.id">
          <p class="name">{{d.name}}</p>
          <div class="item-list" v-for="item in d.products" :key="item.id">
            <div class="card">
              <div class="img">
                <img :src="item.pic" alt="">
              </div>
              <div class="card-right">
                <p class="title">{{item.name}}</p>
                <p class="money">{{item.price}}元</p>
                <btn-box :good="item"></btn-box>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="bottom">
        <div class="shop">
          购物车
        </div>
        <div class="price">
          ￥121212
        </div>
        <div class="check">
          选好了
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import BtnView from '@/components/BtnView'
export default {
  components: {
    'btn-box':BtnView
  },
  data () {
    return {
      list:[]
    }
  },
  created () {
    console.log(111);
    this.axios.get('/product/list').then(({data}) => {
      console.log(data);
      this.list = data.data
      console.log(this.list);
    })
  }
}
</script>
<style scoped lang="sass">
.list
  position: fixed
  top: 0
  bottom: 0
  left: 0
  right: 0
  background: #fff
  padding: .2rem .2rem
  overflow: auto
  .main
    display: flex
    justify-content: space-between
    .left
      background: #f0f0f0
      height: 100vh
      padding: 0 .4rem
      position: fixed
      .left-list
        margin-bottom: .2rem
    .right
      margin-left: 40%
      margin-bottom: 2rem
      .name
        display: flex
        margin-bottom: .2rem
        margin-top: .4rem
        background: #f0f0f0
      .card
        display: flex 
        .img
          img
            width: 2rem
            height: 2rem
    .bottom
      position: fixed
      bottom: 0
      background: #fff
      height: 1.5rem
      width: 100%
      display: flex
      justify-content: space-around
      .shop
        width: 1.5rem
        background: skyblue
        display: flex
        align-items: center
        justify-content: center
      .check
        width: 1.5rem
        background: skyblue
        display: flex
        align-items: center
        justify-content: center
</style>